import React from 'react';
import { Pagination } from 'antd';
import type { PaginationProps } from 'antd';
interface pageProps extends PaginationProps {
  pagination: {
    current: number;
    pageSize: number;
    total: number;
    totalPage: number;
    onChange: (current: number, pageSize: number) => void;
    changeCurrent: (current: number) => void;
    changePageSize: (pageSize: number) => void;
  };
  total: number;
}
const UniversalPagination = (props: pageProps) => {
  const { pagination, total } = props;
  return (
    <Pagination
      current={pagination.current}
      pageSize={pagination.pageSize}
      onChange={pagination.onChange}
      showTotal={(_, range) => `第 ${range[0]}-${range[1]} 条/总共 ${total} 条`}
      showSizeChanger
      style={{ padding: '20px 24px', textAlign: 'right' }}
      {...props}
    />
  );
};

export default UniversalPagination;
